package com.sun.pojo;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

/**
 * @Author SunBingRui
 * @Date 2020/5/15 15:13
 */
@Component//注解在类上，自动生成bean
@Scope("singleton")//注解作用域
public class User {
   // @Value("张三")//可以注解在属性上
    public String name;
    /*
    * 等价于
    * <bean class="com.sun.pojo.User" id="user2">
         <property name="name" value="张三"/>
    </bean>
    * */

    public String getName() {
        return name;
    }
   // @Value("张三")//也可以注解在set方法上
    public void setName(String name) {
        this.name = name;
    }
}
